package patterns.service;

/**
 * Created by lenovo on 2016/12/12 0012.
 * 演示
 */
public class ServiceLocatorPatternDemo {
    public static void main(String[] args){
        //service都是新建
        IService service = ServiceLocator.getService("service1");
        service.execute();

        service = ServiceLocator.getService("service2");
        service.execute();

        //service开始使用缓存
        service = ServiceLocator.getService("service1");
        service.execute();
        service = ServiceLocator.getService("service2");
        service.execute();
    }
}
